<?php

namespace app\product\admin;
use app\system\admin\Admin;
use app\product\model\Unit as UnitModel;


class Unit extends Admin
{
    protected $hisiModel = 'Unit';//模型名称[通用添加、修改专用]
    public function index()
    {
        if ($this->request->isAjax()) {
            $where      = [];
            $page       = $this->request->param('page/d', 1);
            $limit      = $this->request->param('limit/d', 15);

            $data['data'] = UnitModel::where($where)
                            ->page($page)
                            ->limit($limit)
                            ->order('weigh asc,id desc')
                            ->select();
            $data['count'] = UnitModel::where($where)->count('id');
            $data['code'] = 0;
            return json($data);

        }
        return $this->fetch();
    }
}
 ?>
